<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../script/jquery-3.6.0.js"></script>
    <script type="text/javascript">
        $(function (){
            $("#buttonQQB").click(function (){
if($("#checkA").prop("checked")){
    $(name=check1).prop("checked",false)
}else {
    $(":checkbox").prop("checked",true)
}

            })

        })

    </script>
</head>
<body>

<div>
  <button id="buttonQQB">全选/全不选</button>
</div>
<div>
  <form>

    <input type="checkbox" name="check1" id="checkA" value="测试1">测试1
    <input type="checkbox" name="check1" id="checkB" value="测试2">测试2
    <input type="checkbox" name="check1" id="checkC"value="测试3">测试3
    <input type="checkbox" name="check1" id="checkD" value="测试4">测试4

  </form>
</div>

</body>
</html>